<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			// 组合模式  原型模型和构模型相结合。
			function Person(name,age){
				this.name = name;
				this.age = age;
				this.friends = ['fyr','xxx']
			}
			Person.prototype = {
				// 改变原型对象的同时要改变原型对象的constructor属性，让它指向当前的构造函数Person
				constructor : Person,
				sayName = function(){
					console.log(this.name)
				}
			}
			var me = new Person('me',18)
			var you = new Person('you',20)
			me.friends.push('yyy')
		</script>
	</body>
</html>
